package cc.laop.entity.system;

import java.io.Serializable;
import java.util.List;

public class Resource implements Serializable, Comparable<Resource> {

	private static final long serialVersionUID = 1L;

	private int id;
	private String name;
	private String description;
	private Integer parentid;
	private String url;
	private Integer status;
	private Integer orderid;
	private String icon;
	private String permission;

	private List<Resource> resourceList;

	public List<Resource> getResourceList() {
		return resourceList;
	}

	public void setResourceList(List<Resource> resourceList) {
		this.resourceList = resourceList;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Integer getParentid() {
		return parentid;
	}

	public void setParentid(Integer parentid) {
		this.parentid = parentid;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public Integer getOrderid() {
		return orderid;
	}

	public void setOrderid(Integer orderid) {
		this.orderid = orderid;
	}

	public String getIcon() {
		return icon;
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}

	public String getPermission() {
		return permission;
	}

	public void setPermission(String permission) {
		this.permission = permission;
	}

	@Override
	public int compareTo(Resource o) {
		int order = 0;
		Integer o1 = this.getOrderid() == null ? 0 : this.getOrderid();
		Integer o2 = o.getOrderid() == null ? 0 : o.getOrderid();
		order = o1.compareTo(o2);
		if (order == 0) {
			order = Integer.compare(this.getId(), o.getId());
		}
		return order;
	}

}
